www.gusucode.com > 落叶冰点万能企业网站内容管理系统 V9.1 > 落叶冰点万能企业网站内容管理系统 V9.1\code\admin\D_del_no_use_uploadfile.asp

    
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>


<LINK href="css.css" type=text/css rel=stylesheet>
<%

dir_set="../"


%>
<%


'**************************************************************
' 新动软网站管理系统
' 官方网站: http://www.aspcpu.com
' 系统作者: 阮丁远(网名:天下程序)
' Copyright 新动软网站管理系统 版权所有
'**************************************************************


%>


<!--#include file=../inc/conn.asp-->
<!--#include file=../inc/Functionb.asp-->

<!--#include file=../inc/ajaxLIB.asp-->

<!--#include file=inc/checkadmin1.asp-->

<!--#include file=../inc/functionFiless.asp-->

<!--#include file=../inc/ND_class_function.asp-->




<%
AJAXshowLoader()


%>


<center>
<br><br>
<br>


<%

Server.ScriptTimeout = 9999999
	igg= 0
         tlllnums=0


call  Del_no_use_File()

Sub Del_no_use_File()


		
		

			Set fso = Server.CreateObject(fssoo_nd_var_str_x_customx)




	If fso.FolderExists(Server.MapPath("../uploadfile/image/")) Then
			Set fsoFile2 = fso.GetFolder(Server.MapPath("../uploadfile/image/"))
	

			For Each DirFiles2 In fsoFile2.SubFolders

                                         


		If Len(DirFiles2) > 0 Then
			strDirName = DirFiles2.Name & "/"
		Else
			strDirName = vbNullString
		End If
		strFolderPath = "../uploadfile/image/" & strDirName
		strFolderPath = Server.MapPath(strFolderPath)
	




		If fso.FolderExists(strFolderPath) Then
			Set fsoFile = fso.GetFolder(strFolderPath)
                           hfnums=0
                        dellenums=0
			For Each DirFiles In fsoFile.Files
                          hfnums=hfnums+1
                          tlllnums=tlllnums+1
				strFileName = strDirName & DirFiles.Name
				strFilePath = strFolderPath & "\" & DirFiles.Name
				If Not CheckFileExists(strFileName) Then
					igg = igg+ 1
                        dellenums=dellenums+1
					fso.DeleteFile(strFilePath)
				End If
			Next
			Set fsoFile = Nothing
		End If

	
            response.write "扫描文件夹 uploadfile/image/" & strDirName&" 中..,发现了" & hfnums&" 个文件,删除了"&dellenums&"个无用的文件<br>"
            response.flush





           next


end if

		Set fso = Nothing

           response.write "<br>共扫描了" & tlllnums&" 个文件,删除了"&igg&"个无用的文件<br>"
            response.flush






		%>


<script language=javascript>
alert("删除了<%=igg%>个垃圾文件");



</script>


<%



	End Sub












Function CheckFileExists(strFileName)
		Dim Rs
		


		CheckFileExists = False


            sql="SELECT TOP 1 id FROM [ND_Article] WHERE  Uploadfile_list like '%" & strFileName & "%'"



		Set Rs = conn.Execute(sql)
                If not Rs.EOF Then

			CheckFileExists = True
		End If

		Set Rs = Nothing


            sql="SELECT TOP 1 id FROM [ND_channel] WHERE  Uploadfile_list like '%" & strFileName & "%'"



		Set Rs = conn.Execute(sql)
                If not Rs.EOF Then

			CheckFileExists = True
		End If

		Set Rs = Nothing

           sql="SELECT TOP 1 id FROM [ND_down] WHERE  Uploadfile_list like '%" & strFileName & "%'"



		Set Rs = conn.Execute(sql)
                If not Rs.EOF Then

			CheckFileExists = True
		End If

		Set Rs = Nothing




           sql="SELECT TOP 1 id FROM [ND_nolistdanArticle] WHERE  Uploadfile_list like '%" & strFileName & "%'"



		Set Rs = conn.Execute(sql)
                If not Rs.EOF Then

			CheckFileExists = True
		End If

		Set Rs = Nothing



           sql="SELECT TOP 1 id FROM [ND_danArticle_class] WHERE  Uploadfile_list like '%" & strFileName & "%'"



		Set Rs = conn.Execute(sql)
                If not Rs.EOF Then

			CheckFileExists = True
		End If

		Set Rs = Nothing




           sql="SELECT TOP 1 id FROM [ND_pic_or_sp] WHERE  Uploadfile_list like '%" & strFileName & "%'"



		Set Rs = conn.Execute(sql)
                If not Rs.EOF Then

			CheckFileExists = True
		End If

		Set Rs = Nothing





           sql="SELECT TOP 1 id FROM [ND_prod] WHERE  Uploadfile_list like '%" & strFileName & "%'"



		Set Rs = conn.Execute(sql)
                If not Rs.EOF Then

			CheckFileExists = True
		End If

		Set Rs = Nothing




           sql="SELECT TOP 1 id FROM [ND_prod_class] WHERE  Uploadfile_list like '%" & strFileName & "%'"



		Set Rs = conn.Execute(sql)
                If not Rs.EOF Then

			CheckFileExists = True
		End If

		Set Rs = Nothing



           sql="SELECT TOP 1 id FROM [ND_friendlink] WHERE smallpic like '%" & strFileName & "%'"



		Set Rs = conn.Execute(sql)
                If not Rs.EOF Then

			CheckFileExists = True
		End If

		Set Rs = Nothing





           sql="SELECT TOP 1 id FROM [ND_piclunbo] WHERE smallpic like '%" & strFileName & "%'"



		Set Rs = conn.Execute(sql)
                If not Rs.EOF Then

			CheckFileExists = True
		End If

		Set Rs = Nothing


	End Function









%>






</center>







<%



AJAXcloseLoader()
%>